﻿<Popup x:Class="UniversalEditor.Modules.OpenRelativeFileModule.OpenRelativeFileView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
			xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
			   xmlns:d="http://schemas.microsoft.com/expression/blend/2008"  mc:Ignorable="d"
			   xmlns:openRelativeFileModule="clr-namespace:UniversalEditor.Modules.OpenRelativeFileModule"
       xmlns:converters="clr-namespace:UniversalEditor.Base.Utils.Converters;assembly=UniversalEditor.Base"
       MinWidth="300" d:DataContext="{x:Static openRelativeFileModule:OpenRelativeFileViewModel.Designer}"
				IsOpen="{Binding IsOpen, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
	<Popup.Resources>
		<converters:ExtensionToImageSourceConverter x:Key="PathToImageSourceConverter"/>
	</Popup.Resources>
	<Border BorderBrush="{x:Static SystemColors.ControlDarkBrush}" BorderThickness="1,0,1,1" Background="{x:Static SystemColors.ControlBrush}">
		<StackPanel Orientation="Vertical">
			<Rectangle Fill="DodgerBlue" Height="2"/>
			<TextBlock Text="Select file from parent folder to open:" Margin="4,2,4,2"/>
			<TextBox  LostFocus="OnLostFocus" Name="Cmb" Text="{Binding FileName, Mode=OneWayToSource, UpdateSourceTrigger=PropertyChanged}" PreviewKeyDown="OnPreviewKeyDown" Margin="2"/>
			
			<ListBox ItemsSource="{Binding Files}" Name="list" PreviewMouseDown="OnListMouseUp" MaxHeight="300">
				<ListBox.ItemTemplate>
					<ItemContainerTemplate>
						<StackPanel Orientation="Horizontal">
							<Image Source="{Binding Converter={StaticResource PathToImageSourceConverter}}" Height="16" Margin="0,0,5,0"/>
							<TextBlock Text="{Binding}" VerticalAlignment="Center"/>
						</StackPanel>
					</ItemContainerTemplate>
				</ListBox.ItemTemplate>
			</ListBox>
		</StackPanel>
	</Border>
</Popup>
